]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
unlockDialog: Fix scale-factor handling on multihead
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 30 Jun 2020 11:08:03 +0000 (13:08 +0200)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Tue, 30 Jun 2020 13:12:08 +0000 (13:12 +0000)
The blur effect needs to take the scale-factor into account, so we
listen for scale changes. However we set up the signal handler when
creating a background, which is repeated for each monitor, and every
time the monitor configuration changes. But we only disconnect the
last handler that was connected, and only when we are destroyed,
not when recreating backgrounds.

Fix this by splitting out updating the effect parameters to a separate
method that iterates over all backgrounds, so we can simply set up the
handler from the constructor.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1341

js/ui/unlockDialog.js

index cbcc2e512f34a1a14958589ada3edb0e5695a4be..c6d70d3382368accf94c8af9fef120bf1ce8b043 100644 (file)
@@ -524,6 +524,10 @@ var UnlockDialog = GObject.registerClass({
 
         this._bgManagers = [];
 
+        const themeContext = St.ThemeContext.get_for_stage(global.stage);
+        this._scaleChangedId = themeContext.connect('notify::scale-factor',
+            () => this._updateBackgroundEffects());
+
         this._updateBackgrounds();
         this._monitorsChangedId =
             Main.layoutManager.connect('monitors-changed', this._updateBackgrounds.bind(this));
@@ -626,6 +630,7 @@ var UnlockDialog = GObject.registerClass({
             y: monitor.y,
             width: monitor.width,
             height: monitor.height,
+            effect: new Shell.BlurEffect({ name: 'blur' }),
         });
 
         let bgManager = new Background.BackgroundManager({
@@ -637,19 +642,17 @@ var UnlockDialog = GObject.registerClass({
         this._bgManagers.push(bgManager);
 
         this._backgroundGroup.add_child(widget);
+    }
 
+    _updateBackgroundEffects() {
         const themeContext = St.ThemeContext.get_for_stage(global.stage);
 
-        let effect = new Shell.BlurEffect({
-            brightness: BLUR_BRIGHTNESS,
-            sigma: BLUR_SIGMA * themeContext.scale_factor,
-        });
-
-        this._scaleChangedId = themeContext.connect('notify::scale-factor', () => {
-            effect.sigma = BLUR_SIGMA * themeContext.scale_factor;
-        });
-
-        widget.add_effect(effect);
+        for (const widget of this._backgroundGroup) {
+            widget.get_effect('blur').set({
+                brightness: BLUR_BRIGHTNESS,
+                sigma: BLUR_SIGMA * themeContext.scale_factor,
+            });
+        }
     }
 
     _updateBackgrounds() {
@@ -661,6 +664,7 @@ var UnlockDialog = GObject.registerClass({
 
         for (let i = 0; i < Main.layoutManager.monitors.length; i++)
             this._createBackground(i);
+        this._updateBackgroundEffects();
     }
 
     _ensureAuthPrompt() {